@layerzerolabs/evm-sdks-core
The EVM SDKs Core package provides essential utilities and tools for interacting with EVM-compatible blockchains. It includes functions for contract error parsing.
Features
- Error Parsing: Parse contract errors and convert them into easy-to-read and structured data.
Installation
To install the EVM SDKs Core package, you can use npm or yarn:
npm install @layerzerolabs/evm-sdks-core
or
yarn add @layerzerolabs/evm-sdks-core
Usage
Error Parsing
import { LayerZeroErrorParser, Abi } from "@layerzerolabs/evm-sdks-core";
import { EndpointV2__factory } from "@layerzerolabs/lz-evm-sdk-v2";
const abi: Abi = Endpoint__factory.createInterface();
const parser = new LayerZeroErrorParser(abi);
const errorData = "...";
const parsedError = parser.parse(errorData);
if (parsedError) {
console.log(`Error: ${parsedError.message}`);
}